PROJECT(ImageProfiler4030e)

cmake_minimum_required(VERSION 2.8)


FIND_PACKAGE(RTK REQUIRED)

INCLUDE(${RTK_USE_FILE})

FIND_PACKAGE(QT4 REQUIRED)

if (QT4_FOUND)
  message (STATUS "Looking for Qt4 - found")
  include (${QT_USE_FILE})
else ()
  message (STATUS "Looking for Qt4 - not found")
endif ()


#Find ITk folder
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
   MESSAGE(FATAL_ERROR 
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)



find_package(Subversion)
if (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
  Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
  message(STATUS "Current SVN revision is ${PROJECT_WC_REVISION}")
  add_definitions(-DBUILD_VER=${PROJECT_WC_REVISION})
else (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
  add_definitions(-DBUILD_VER=3)
endif (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)


SET(ImageProfiler4030e_SOURCES
	main.cpp
	imageprofiler4030e.cpp
	YK16GrayImage.cxx
	qyklabel.cpp
	qcustomplot.cpp
	)

SET(ImageProfiler4030e_HEADERS
	imageprofiler4030e.h
	YK16GrayImage.h
	qyklabel.h
	qcustomplot.h
	)

SET(ImageProfiler4030e_FORMS
	imageprofiler4030e.ui)

#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /subsystem:windows /ENTRY:mainCRTStartup")

QT4_WRAP_CPP(ImageProfiler4030e_HEADERS_MOC ${imageprofiler4030e_HEADERS})

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

QT4_WRAP_CPP(ImageProfiler4030e_HEADERS_MOC ${ImageProfiler4030e_HEADERS})
QT4_WRAP_UI(ImageProfiler4030e_FORMS_HEADERS ${ImageProfiler4030e_FORMS})
#QT4_ADD_RESOURCES(ImageProfiler4030e_RESOURCES_RCC ${ImageProfiler4030e_RESOURCES})

ADD_EXECUTABLE(ImageProfiler4030e ${ImageProfiler4030e_SOURCES} 
	${ImageProfiler4030e_HEADERS} 
    ${ImageProfiler4030e_HEADERS_MOC} 
    ${ImageProfiler4030e_FORMS_HEADERS} 
     )
#  ${imageprofiler4030e_RESOURCES_RCC}

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

SET(QT_USE_QTCORE TRUE)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)

#TARGET_LINK_LIBRARIES(ItkCon ${ITK_LIBRARIES} )
TARGET_LINK_LIBRARIES(ImageProfiler4030e ${RTK_LIBRARIES} ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${ITK_LIBRARIES})